import {messages} from "share/common";
import {Select} from 'antd';
const Option = Select.Option;
export default {
  tagParseFormat(value, arr) {
    let label = '';
    arr.map(item => {
      if (item.value === value) {
        label = item.label;
      }
    });
    return label;
  },
  getFormItems(){
    let status = [
      {label: messages('common.all')/*全部*/, value: 'all'},
      {label: messages('supplier.key1077')/*询价中*/, value: '1'},
      {label: messages('supplier.key1078')/*已关闭*/, value: '0'},
    ];
    return [
      {
        component: 'Select',
        label: messages('supplier.key951')/*询价状态*/,
        id: 'status',
        tagUnclosed: true,
        props: {
          style: {width: '100%'},
        },
        children: status.map(item => <Option key={item.value}>{item.label}</Option>),
        tagParser: (value) => this.tagParseFormat(value, status),
        parser: value => ({
          status: value === 'all' ? '' : value
        })
      },
      {
        component: 'Input',
        label: messages('supplier.key285')/*公司名称*/,
        id: 'companyName',
        props: {
          style: {width: '100%'},
          placeholder: messages('common.please.input'/*请输入*/),
        },
      },
      {
        component: 'Input',
        label: messages('supplier.key952')/*申请单号*/,
        id: 'businessCode',
        props: {
          style: {width: '100%'},
          placeholder: messages('common.please.input'/*请输入*/),
        },
      },
      {
        component: 'Input',
        label: messages('supplier.key953')/*预订人姓名*/,
        id: 'bookerName',
        props: {
          style: {width: '100%'},
          placeholder: messages('common.please.input'/*请输入*/),
        },
      },
      {
        component: 'Input',
        label: messages('supplier.key954')/*预订人工号*/,
        id: 'bookerEmployeeNo',
        props: {
          style: {width: '100%'},
          placeholder: messages('common.please.input'/*请输入*/),
        },
      },
    ]
  }
}
